package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.GreenhousefilmApplyConMapper;
import com.ruoyi.consume.domain.GreenhousefilmApplyCon;
import com.ruoyi.consume.service.IGreenhousefilmApplyConService;

/**
 * 棚膜领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-23
 */
@Service
public class GreenhousefilmApplyConServiceImpl implements IGreenhousefilmApplyConService
{
    @Autowired
    private GreenhousefilmApplyConMapper greenhousefilmApplyConMapper;

    /**
     * 查询棚膜领用
     *
     * @param greenhousefilmApplyId 棚膜领用ID
     * @return 棚膜领用
     */
    @Override
    public GreenhousefilmApplyCon selectGreenhousefilmApplyById(Long greenhousefilmApplyId)
    {
        return greenhousefilmApplyConMapper.selectGreenhousefilmApplyById(greenhousefilmApplyId);
    }

    /**
     * 查询棚膜领用列表
     *
     * @param greenhousefilmApplyCon 棚膜领用
     * @return 棚膜领用
     */
    @Override
    public List<GreenhousefilmApplyCon> selectGreenhousefilmApplyList(GreenhousefilmApplyCon greenhousefilmApplyCon)
    {
        return greenhousefilmApplyConMapper.selectGreenhousefilmApplyList(greenhousefilmApplyCon);
    }

    /**
     * 新增棚膜领用
     *
     * @param greenhousefilmApplyCon 棚膜领用
     * @return 结果
     */
    @Override
    public int insertGreenhousefilmApply(GreenhousefilmApplyCon greenhousefilmApplyCon)
    {
        greenhousefilmApplyCon.setCreateTime(DateUtils.getNowDate());
        return greenhousefilmApplyConMapper.insertGreenhousefilmApply(greenhousefilmApplyCon);
    }

    /**
     * 修改棚膜领用
     *
     * @param greenhousefilmApplyCon 棚膜领用
     * @return 结果
     */
    @Override
    public int updateGreenhousefilmApply(GreenhousefilmApplyCon greenhousefilmApplyCon)
    {
        greenhousefilmApplyCon.setUpdateTime(DateUtils.getNowDate());
        return greenhousefilmApplyConMapper.updateGreenhousefilmApply(greenhousefilmApplyCon);
    }

    /**
     * 批量删除棚膜领用
     *
     * @param greenhousefilmApplyIds 需要删除的棚膜领用ID
     * @return 结果
     */
    @Override
    public int deleteGreenhousefilmApplyByIds(Long[] greenhousefilmApplyIds)
    {
        return greenhousefilmApplyConMapper.deleteGreenhousefilmApplyByIds(greenhousefilmApplyIds);
    }

    /**
     * 删除棚膜领用信息
     *
     * @param greenhousefilmApplyId 棚膜领用ID
     * @return 结果
     */
    @Override
    public int deleteGreenhousefilmApplyById(Long greenhousefilmApplyId)
    {
        return greenhousefilmApplyConMapper.deleteGreenhousefilmApplyById(greenhousefilmApplyId);
    }

    /**
     * 更新库存量表
     *
     * @param greenhousefilmApplyCon 棚膜领用ID
     * @return 结果
     */
    @Override
    public int updateGreenhousefilmAmount(GreenhousefilmApplyCon greenhousefilmApplyCon){
        return greenhousefilmApplyConMapper.updateGreenhousefilmAmount(greenhousefilmApplyCon);
    }

    /**
     * 更新领用状态
     *
     * @param greenhousefilmApplyId 棚膜领用ID
     * @return 结果
     */
    @Override
    public int updateConsumeStatus(Long greenhousefilmApplyId){
        return greenhousefilmApplyConMapper.updateConsumeStatus(greenhousefilmApplyId);
    }

    /**
     * 退回操作
     *
     * @param greenhousefilmApplyId 棚膜领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long greenhousefilmApplyId){
        return greenhousefilmApplyConMapper.updateApprovalStatus(greenhousefilmApplyId);
    }
}
